using System;
using System.Data;
using System.Collections.Generic;
using System.Text;

namespace BUS
{
    public class QuyDinh
    {
        public static bool Insert(string sql)
        {
            DAO.QuyDinh bc = new DAO.QuyDinh();
            return bc.Insert(sql);
        }
        public static bool Update(string sql)
        {
            DAO.QuyDinh bc = new DAO.QuyDinh();
            return bc.Update(sql);
        }
        public static bool Delete(string sql)
        {
            DAO.QuyDinh bc = new DAO.QuyDinh();
            return bc.Delete(sql);
        }
        public static DataTable Select(string sql)
        {
            DAO.QuyDinh bc = new DAO.QuyDinh();
            return bc.Select(sql);
        }

        //Chi super star :))

        public static DTO.QuyDinh LayTenQuiDinh()
        {
            DAO.QuyDinh dao = new DAO.QuyDinh();
            string sql = "SELECT * FROM QuyDinh";
            DataTable dt = dao.Select(sql);
            DTO.QuyDinh dto = new DTO.QuyDinh();
            dto.KhoangCachXuatBan = (int)dt.Rows[0]["KhoangCachXuatBan"];
            dto.SoSachToiDa = (int)dt.Rows[0]["SoSachToiDa"];
            dto.ThoiGianMuonToiDa = (int)dt.Rows[0]["ThoiGianMuonToiDa"];
            dto.ThoiGianSuDung = (int)dt.Rows[0]["ThoiGianSuDung"];
            dto.TienPhatTraTre = (int)dt.Rows[0]["TienPhatTraTre"];
            dto.TuoiToiDa = (int)dt.Rows[0]["TuoiToiDa"];
            dto.TuoiToiThieu = (int)dt.Rows[0]["TuoiToiThieu"];
            return dto;
        }
    }
}
